package com.pf.controller;

import com.pf.common.anotation.Authentication;
import lombok.Data;
import org.springframework.web.bind.annotation.*;

/**
 * @author PanFei
 * @version 1.0.0
 * @createTime 2022/11/25 10:15
 */
@RestController
@RequestMapping("/aop")
public class AopController {

    @Data
    public static class DTO {
        private Long projectId;
        private String name;
    }

    @PostMapping("/test1")
    @Authentication
    public String test1(@RequestBody DTO param) {
        System.out.println("test1...param=" + param);
        return "test1";
    }

    @PostMapping("/test2")
    @Authentication
    public String test2(DTO param) {
        System.out.println("test2...param=" + param);
        return "test2";
    }

    @GetMapping("/test3")
    @Authentication
    public String test3(@RequestParam(value = "projectId",required = false) Long projectId, @RequestParam(value = "name",required = false) String name) {
        System.out.println("test3...projectId=" + projectId + "name=" + name);
        return "test3";
    }

    @GetMapping("/test4/{projectId}/{name}")
    @Authentication
    public String test4(@PathVariable("projectId") Long projectId, @PathVariable("name") String name) {
        System.out.println("test4...projectId=" + projectId + "name=" + name);
        return "test4";
    }

}
